using System;
using System.Collections.Generic;
using System.Text;
using AgilePlannerDT.Data;

namespace AgilePlannerDT.Persister
{
    public interface SynchronousPersister
    {
        #region Properties

        /// <summary>
        /// Gets the current project.
        /// </summary>
        /// <value>The project.</value>
        Project Project
        {
            get;
            set;
        }

        #endregion

        #region Load

        /// <summary>
        /// Loads the specified project.
        /// </summary>
        /// <param name="projectName">Name of the project.</param>
        /// <returns></returns>
        Project Load(String projectName);

        /// <summary>
        /// Loads the interation of the specified project that are inside the given timeframe.
        /// </summary>
        /// <param name="projectName">Name of the project.</param>
        /// <param name="start">The start.</param>
        /// <param name="end">The end.</param>
        /// <returns></returns>
        Project Load(String projectName, DateTime start, DateTime end);

        /// <summary>
        /// Gets a list with names of available project.
        /// </summary>
        /// <returns></returns>
        List<String> GetProjectNames();

        #endregion

        #region Create

        /// <summary>
        /// Creates a backlog. Only one backlog is allowed per project. Creating a second one
        /// will raise an exception.
        /// </summary>
        /// <param name="width">The width.</param>
        /// <param name="height">The height.</param>
        /// <param name="locationX">The location X.</param>
        /// <param name="locationY">The location Y.</param>
        /// <returns></returns>
        Backlog CreateBacklog(int width, int height, int locationX, int locationY);

        /// <summary>
        /// Creates an iteration.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <param name="description">The description.</param>
        /// <param name="width">The width.</param>
        /// <param name="height">The height.</param>
        /// <param name="locationX">The location X.</param>
        /// <param name="locationY">The location Y.</param>
        /// <param name="availableEffort">The available effort.</param>
        /// <param name="startDate">The start date.</param>
        /// <param name="endDate">The end date.</param>
        /// <returns></returns>
        Iteration CreateIteration(String name, String description, int width, int height, int locationX, int locationY, float availableEffort,
                DateTime startDate, DateTime endDate);

        /// <summary>
        /// Creates a project.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <returns></returns>
        Project CreateProject(String name);

        /// <summary>
        /// Creates a story card.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <param name="description">The description.</param>
        /// <param name="width">The width.</param>
        /// <param name="height">The height.</param>
        /// <param name="locationX">The location X.</param>
        /// <param name="locationY">The location Y.</param>
        /// <param name="parentid">The parentid.</param>
        /// <param name="bestCaseEstimate">The best case estimate.</param>
        /// <param name="mostlikelyEstimate">The mostlikely estimate.</param>
        /// <param name="worstCaseEstimate">The worst case estimate.</param>
        /// <param name="actualEffort">The actual effort.</param>
        /// <param name="status">The status.</param>
        /// <param name="color">The color.</param>
        /// <param name="cardOwner">The card owner.</param>
        /// <param name="rotationAngle">The rotation angle.</param>
        /// <returns></returns>
        StoryCard CreateStoryCard(String name, String description, int width, int height, int locationX, int locationY, long parentid,
                float bestCaseEstimate, float mostlikelyEstimate, float worstCaseEstimate, float actualEffort, String status, String color, String cardOwner, float rotationAngle,string rallyID, string fitID);

        #endregion

        #region Delete

        /// <summary>
        /// Deletes an index card (either Backlog, Iteration or StoryCard).
        /// </summary>
        /// <param name="id">The id.</param>
        /// <returns></returns>
        IndexCard DeleteCard(long id);

        /// <summary>
        /// Deletes the project.
        /// </summary>
        /// <param name="projectName">Name of the project.</param>
        /// <returns></returns>
        bool DeleteProject(string projectName);

        #endregion

        #region Undelete

        /// <summary>
        /// Undeletes the card.
        /// </summary>
        /// <param name="indexCard">The index card.</param>
        /// <returns></returns>
        IndexCard UndeleteCard(IndexCard indexCard);

        #endregion

        #region Update

        /// <summary>
        /// Updates the card.
        /// </summary>
        /// <param name="indexCard">The index card.</param>
        /// <returns></returns>
        IndexCard UpdateCard(IndexCard indexCard);

        /// <summary>
        /// Updates the legend.
        /// </summary>
        /// <param name="legend">The legend.</param>
        /// <returns></returns>
        Legend UpdateLegend(Legend legend);
        Project UpdateProject(Project project);

        void AddNewUser(TeamMember member);

        void RemoveUser(TeamMember member);

        #endregion

        #region Move

        /// <summary>
        /// Moves the story card to new parent.
        /// </summary>
        /// <param name="id">The id.</param>
        /// <param name="oldparentid">The oldparentid.</param>
        /// <param name="newparentid">The newparentid.</param>
        /// <param name="locationX">The location X.</param>
        /// <param name="locationY">The location Y.</param>
        /// <param name="rotationAngle">The rotation angle.</param>
        /// <returns></returns>
        StoryCard MoveStoryCardToNewParent(long id, long oldparentid, long newparentid, int locationX, int locationY, float rotationAngle);

        #endregion

        #region Find Index Card

        /// <summary>
        /// Finds the card.
        /// </summary>
        /// <param name="id">The id.</param>
        /// <returns></returns>
        IndexCard FindCard(long id);

        #endregion

        #region Project

        /// <summary>
        /// Arranges the project.
        /// </summary>
        /// <param name="project">The project.</param>
        /// <returns></returns>
        Project ArrangeProject(Project project);

        #endregion

        #region Dot Voting

        void StartVoting();

        #endregion
    }
}
